Page({
  data:{
    month:'',
    year:'',
    // currentDate: new Date(),
    // lastDay: null
  },
  // onLoad: function () {
  //   const today = new Date();
  //   this.setData({
  //     lastDay: new Date(today.getFullYear(), today.getMonth() + 1, 0)
  //   })
  // },
  selectDate(e){
    console.log(e.detail)
    // 将时间字符串转化成 Date 对象
    const date = new Date(e.detail);
    // 获取月份，月份是 0-11 表示 1 到 12 月，需要加 1
    const month = date.getMonth() + 1;
    // 获取年份
    const year = date.getFullYear();
    this.setData({month,year})
    this.getTask()
  },
 async getTask(){
   const {month,year} = this.data
  const res = await wx.http.get('/driver/users/taskReport',{month,year})
  console.log(res);
  },
  onClickLeft() {
    wx.navigateBack({
      delta:1
    })
  }
})
